<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="<?php echo(Yii::app()->params['app']['host'].Yii::app()->params['app']['logoSmall']);?>" />
<title><?php echo(Yii::app()->params['app']['name'])?> - <?php echo(Yii::app()->params['app']['title'])?></title>
<meta name="keywords" content="<?php echo(Yii::app()->params['app']['name'])?>" />
<meta name="description" content="<?php echo(Yii::app()->params['app']['name'])?>" />
<link href="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/css/default.css?v=<?php echo(Yii::app()->params['app']['version'])?>" rel="stylesheet" type="text/css" />
<link href="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/css/frame_android_down.css?v=<?php echo(Yii::app()->params['app']['version'])?>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/jquery.js?v=<?php echo(Yii::app()->params['app']['version'])?>" charset="utf-8"></script>
<script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/tianshengwocai.js?v=<?php echo(Yii::app()->params['app']['version'])?>" charset="utf-8"></script>
<style>
.errorSummary {
    background: none repeat scroll 0 0 #FFEEEE;
    border: 2px solid #CC0000;
    font-size: 0.9em;
    margin: 0 0 0px 50px;
    padding: 0px 0px 0px 12px;
    position:absolute;
    width:200px;
    height:25px;
}
.errorSummary ul {
    margin: 0;
    padding: 0 0 0 20px;
}
</style>

<script type="text/javascript">
/*
* discription: set homepage
*/
function setHomepage(){
    if (document.all){
        document.body.style.behavior='url(#default#homepage)';
          document.body.setHomePage(window.location.href);
    }else if (window.sidebar){
        if(window.netscape){
            try{
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }catch (e){
                alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage',window.location.href);
    }else{
        alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');
    }
}
</script>
</head>

<body id="login">
<div id="login_main">

    <div class="login_header">
        <div class="logol"><img src="<?php echo(Yii::app()->params['app']['host']."/".Yii::app()->params['app']['logo']);?>"   height="58px"/></div>
        
        <div class="lB">
            　<a onclick="setHomepage()">设为首页</a>
        </div><!-- HB -->
    </div>
    
    <div class="login_cont">
    
        <div class="login_flash">
        
            <div class="flash">
                <div id="focus_change">
                    <div id="focus_change_list">
                        <ul>
                            <li><img src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/flash_1.jpg" /></li>
                            <li><img src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/flash_2.jpg" /></li>
                            <li><img src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/flash_3.jpg" /></li>
                            <li><img src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/flash_4.jpg" /></li>
                        </ul>
                    </div>
                </div>
                
                <div class="focus">
                    <div id="focus_change_word">
                        <ul>
                            <li id="oADIV1">自己的云盘，安全，不担心数据泄密</li>
                            <li id="oADIV2" style="display: none;">自己的云盘</li>
                            <li id="oADIV3" style="display: none;">快速</li>
                            <li id="oADIV4" style="display: none;">私有云</li>
                        </ul>
                    </div>
                    <div id="focus_change_btn">
                        <ul>
                            <li class="current">1</li>
                            <li>2</li>
                            <li>3</li>
                            <li>4</li>
                        </ul>
                    </div>
                </div>
            </div>
            
        </div>
        
        <?php $form=$this->beginWidget('CActiveForm', array()); ?>
        <div class="login_window">
            <div class="up">
                <h3>登录您的<?php echo(Yii::app()->params['app']['name'])?></h3>
                <div id="errorTip"><?php echo $form->errorSummary($model,""); ?></div>
                <ul>
                    <?php $account="请输入您的账号/邮箱/手机";$password="";if(SYSTEM_STATUS == "init"){$account="admin";$password="admin";}?>
                    <li><label>帐　号：</label><p><?php echo $form->textField($model,'userName',array("class"=>"input", "autocomplete"=>"on", "value"=>"$account","id"=>"userName","onclick"=>"javascript:if(this.value=='$account'){this.value='';}")); ?></p></li>
                    <li><label>密　码：</label><p><?php echo $form->passwordField($model,'password',array("class"=>"input","value"=>"$password","id"=>"password")); ?></p></li>
                </ul>
<!--                <div class="tip"><a href="<?php echo Yii::app()->params['app']['getpwUrl']?>">忘记密码？</a></div>-->
                <div class="tip"><!--<?php echo $form->checkBox($model,'rememberMe'); ?><?php echo $form->label($model,'两周内自动登录');?>--><a href="<?php echo(Yii::app()->params['app']['getpwUrl'])?>">忘记密码？</a></div>
            
                <div class="btn"> <input id="loginButton" type="submit" value=" " class="sub_btn1" /> <?php if(Yii::app()->params['app']['enabledReigster']){?><a href="<?php echo(Yii::app()->params['app']['registerUrl'])?>" class="sub_btn2"></a><?php }?></div>
            </div>
            
            <ul class="dn">
                <?php 
                $href = '#';
                $android_href = "http://www.miniyun.cn/index.php?r=app/download&type=android";
                $windows_href = "http://www.miniyun.cn/index.php?r=app/download&type=windows&mime=exe";
                $ios_href     = "http://itunes.apple.com/app/mi-ni-yun/id496835613?mt=8";
                $androidClick = "onclick=\"javascript:document.getElementById('android_down_pop').style.visibility ='visible';\"";
                $iosClick = "onclick=\"javascript:document.getElementById('ios_down_pop').style.visibility ='visible';\"";
                $is_mini = Yii::app()->params['app']['eversion'];
                if($is_mini == 0){
                    $href =  "http://www.miniyun.cn/index.php?r=app/download&mid=".Yii::app()->params['app']['mid']."&type=ios";
                    $android_href = "http://www.miniyun.cn/index.php?r=app/download&mid=".Yii::app()->params['app']['mid']."&type=android";
                    $windows_href = "http://www.miniyun.cn/index.php?r=app/download&mid=".Yii::app()->params['app']['mid']."&type=windows&mime=exe";
                    $ios_href     = "http://www.miniyun.cn/index.php?r=app/download&mid=".Yii::app()->params['app']['mid']."&type=ios";
                }?>
                <li><a href="<?php echo $windows_href;?>"><img border="0" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/version1.gif" /></a><span><a href="<?php echo $windows_href;?>">立刻下载</a></span></li>
                <li><a href='#'><img <?php echo $androidClick;?> border="0" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/version2.gif" /></a><span><a href='#' <?php echo $androidClick;?>>立刻下载</a></span></li>
                <li><a href='<?php echo $href;?>'><img <?php if ($is_mini == 1){echo $iosClick;}?> border="0" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/images/version3.gif" /></a><span><a <?php if ($is_mini == 1){echo $iosClick;}?> href="<?php if ($is_mini == 1){echo $href;} else{echo $ios_href;}?>">立刻下载</a></span></li>
            </ul>
        
        </div>
      <?php $this->endWidget(); ?>
    </div>

</div>

<script type="text/javascript">
var userName = $("#userName");
var password = $("#password");
userName.focus(function() {
    var rel = userName.attr("rel");
    if(rel=="0"){
        userName.val("");
        userName.attr("rel","1");
    }
});
userName.blur(function() {
    var value = userName.val();
    if(value==""){
        userName.val("请输入您的账号/邮箱/手机");
        userName.attr("rel","0");
    }
});

var loginButton = $("#loginButton");
loginButton.click(function() {
    var rel = userName.attr("rel");
    if(rel=="0"){
        errorTipMes("用户名不能为空");
        userName.focus();
        return false;
    }

    var text = password.val();
    if(text==""){
        errorTipMes("密码不能为空");
        password.focus();
        return false;
    }
    return true;
});


function errorTipMes(message){
    var errorTip = $("#errorTip");
    $('.errorSummary').remove();
    errorTip.html("<div class=\"errorSummary\"><ul><li>"+message+"</li></ul></div>");
}

</script>
<?php include 'downmanager.php';?>
</body>
</html>